package MathHomeWorkTest;
/*
冒泡排序
 */
public class MathTest19 {
    public static void main(String[] args){
        int arr[] = {1,4,2,5,10,34,12,23,64,23};
        int length = arr.length;
        for(int i = 0; i < length; i++){        //需要比较的趟数
            for(int j = 0; j < length - i - 1; j++){  //两数比较的次数
                if(arr[j] > arr[j+1]){
                    int temp = arr[j];    //数据交换位置
                    arr[j] = arr[j+1];
                    arr[j+1] = temp;
                }
            }
        }
        for(int i = 0; i < length;i++){
            System.out.println(arr[i]);
        }
    }
}
